/*************************************************************************
	> File Name: test4.cc
	> Author: H.M. Lau
	> Mail: hm.lau@outlook.com
	> Created Time: 2023/09/22 19:05
 ************************************************************************/

#include <iostream>
#include <thread>
#include <unistd.h>

void fun()
{
    while (1) {
        std::cout << "Hello new thread." << std::endl;
        sleep(1);
    }
}

int main(int argc, char *argv[])
{
    std::thread t(fun);
    std::thread t1(fun);
    std::thread t2(fun);
    std::thread t3(fun);
    std::thread t4(fun);
    while (1) {
        std::cout << "Hello main thread." << std::endl;
        sleep(1);
    }
    t.join();
    return 0;
}
